using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia.Data.Converters;
using Material.Icons;

namespace AYE_ClientSideAvalonia.Converters;

public class StringToMaterialIconKindConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (value is string str)
        {
            if (Enum.TryParse<MaterialIconKind>(str, out var result))
                return result;
        }

        return MaterialIconKind.QuestionMark; // 默认图标
    }
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotSupportedException();
    }
}
